package com.huidu.bitrade.vo;

import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ExchangeOrderDTO {

    @ApiModelProperty(hidden = true)
    private String orderId;

    @ApiModelProperty("下单数量")
    private BigDecimal amount;

    @ApiModelProperty("下单价格")
    private BigDecimal price;

    @ApiModelProperty("成交状态")
    private String status;

    @ApiModelProperty("交易对")
    private String symbol;

    @ApiModelProperty("币单位")
    private String coinSymbol;

    @ApiModelProperty("结算单位")
    private String baseSymbol;

    @ApiModelProperty("挂单类型")
    private String type;

    @ApiModelProperty("订单方向")
    private String direction;


    public ExchangeOrderDTO withStatus(int status) {
        switch (status) {
            case 0: {
                this.status = "交易中";
                return this;
            }
            case 1: {
                this.status = "完全成交";
                return this;
            }
            case 2: {
                this.status = "撤单";
                return this;
            }
            case 3: {
                this.status = "超时";
                return this;
            }
        }
        return this;
    }

    public ExchangeOrderDTO withType(int type) {
        switch (type) {
            case 0: {
                this.type = "市单";
                return this;
            }
            case 1: {
                this.type = "限单";
                return this;
            }
        }
        return this;
    }

    public ExchangeOrderDTO withDirection(int direction) {
        switch (direction) {
            case 0: {
                this.type = "买入";
                return this;
            }
            case 1: {
                this.type = "卖出";
                return this;
            }
        }
        return this;
    }
}

